package com.lagou.jedisCluster;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashSet;
import java.util.Set;

public class ClusterSetAndGet {
    public static void main(String[] args) {
        Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
        jedisClusterNode.add(new HostAndPort("192.168.208.81", 7001));
        jedisClusterNode.add(new HostAndPort("192.168.208.81", 7002));
        jedisClusterNode.add(new HostAndPort("192.168.208.81", 7003));
        jedisClusterNode.add(new HostAndPort("192.168.208.81", 7004));
        jedisClusterNode.add(new HostAndPort("192.168.208.81", 7005));
        jedisClusterNode.add(new HostAndPort("192.168.208.81", 7006));
        jedisClusterNode.add(new HostAndPort("192.168.208.81", 7007));
        jedisClusterNode.add(new HostAndPort("192.168.208.81", 7008));
        JedisCluster jcd = new JedisCluster(jedisClusterNode);
        jcd.set("name:001","zhangfei");
        String value = jcd.get("name:001");
        System.out.println(value);
    }
}
